﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class QuanTri_TrangPhieuDiemChiTietHS : System.Web.UI.Page
{
    SoLienLacDataContext db = new SoLienLacDataContext();
    clsThaoTac clstt = new clsThaoTac();
    string mahs;
    string tenhs;
    string manam;
    string tenlop;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["Username"] == null || Session["Username"].ToString() == "")
        {
            Response.Redirect("~/GiaoDienClient/TrangChu.aspx");
        }
        else
        {
            mahs = Request.QueryString["MaHS"];
            var c = from p in db.HocSinhs where p.MaHS == mahs select p.TenHS;
            tenhs = c.First().ToString();
            manam = Request.QueryString["MaNam"];
            lblMaHS.Text = mahs;
            lblTenHS.Text = tenhs;
            lblTenLop.Text = Request.QueryString["TenLop"];
            if (!IsPostBack)
            {
                if (rdoKyI.Checked == true)
                {
                    clstt.LoadDiemChiTiet(int.Parse(manam), 1, mahs, grDiemChiTiet, lblDTB, lblHanhKiem, lblHocLuc);
                    MultiView1.ActiveViewIndex = 0;
                }
            }
        }
    }
    protected void rdoKyI_CheckedChanged(object sender, EventArgs e)
    {
        if (rdoKyI.Checked == true)
        {
            clstt.LoadDiemChiTiet(int.Parse(manam), 1, mahs, grDiemChiTiet, lblDTB, lblHanhKiem, lblHocLuc);
            MultiView1.ActiveViewIndex = 0;
        }
        
    }
    protected void rdoKyII_CheckedChanged(object sender, EventArgs e)
    {
        if (rdoKyII.Checked == true)
        {
            clstt.LoadDiemChiTiet(int.Parse(manam), 2, mahs, grDiemChiTiet, lblDTB, lblHanhKiem, lblHocLuc);
            MultiView1.ActiveViewIndex = 0;
        }
        
    }
    protected void rdoCaNam_CheckedChanged(object sender, EventArgs e)
    {
        
        if (rdoCaNam.Checked == true)
        {
            MultiView1.ActiveViewIndex = 1;
            clstt.LoadGridCaNam(int.Parse(manam), mahs, grvDTBCaNam);
            lblDTB.Text = "";
            lblHanhKiem.Text = "";
            lblHocLuc.Text = "";
        }
    }
    protected void imbBack_Click(object sender, ImageClickEventArgs e)
    {
        Response.Redirect("TrangDanhSachHS.aspx");

    }
}